package com.itmk.web.goods_collect.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itmk.web.goods_collect.entity.CollectParm;
import com.itmk.web.goods_collect.entity.GoodsCollect;
import com.itmk.web.goods_collect.entity.PageParm;
import com.itmk.web.goods_collect.mapper.GoodsCollectMapper;
import com.itmk.web.goods_collect.service.GoodsCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 山顶洞人郑某
 * @className GoodsCollectServiceImpl.java
 * @date 2023 12 11
 */
@Service
public class GoodsCollectServiceImpl extends ServiceImpl<GoodsCollectMapper,GoodsCollect> implements GoodsCollectService {

    @Autowired
    GoodsCollectMapper goodsCollectMapper;
    @Override
    public IPage<PageParm> getMyCollect(CollectParm parm) {
        Page<PageParm> page = new Page<>(parm.getCurrentPage(),parm.getPageSize());
        return goodsCollectMapper.getMyCollect(page,parm.getUserId());
    }

    @Override
    public Long maxId() {
        long id = goodsCollectMapper.maxId()+1;
        goodsCollectMapper.updaeMaxId(id+1);
        return id;
    }
}
